using System;
using System.Collections.Generic;
using System.Data;
using System.Xml;
using System.IO;
using System.Web;

namespace AliCMS.SystemModule
{
    public interface IInstanceConfig : IObject
    {
        Dictionary<string, string> GetBasicSettings();
        void SetBasicSettings(Dictionary<string, string> value);

        Dictionary<string, string> GetEmailSettings();
        void SetEmailSettings(Dictionary<string, string> value);

        Dictionary<string, string> GetWaterMarkSettings();
        void SetWaterMarkSettings(Dictionary<string, string> value);

        Dictionary<string, string> GetGlobalSettings();
        void SetGlobalSettings(Dictionary<string, string> value);

        DataTable GetLanguageSettings();

        void UploadLogo(string fieldName, ref string uploadFile, bool isLast);
        void UploadLink(string fieldName, ref string uploadFile, bool isLast);
        void UploadWaterMarkImage(string fieldName, ref string uploadFile, bool isLast);

        void Save();
    }
    public interface ILanguage : IDbObject
    {
        void Delete(int id, bool all);
    }
    public interface IModule : IObject
    {
        Dictionary<string, object> Get(string ns);
        Guid Add(Dictionary<string, object> item);
        void Modify(string ns, Dictionary<string, object> changes);
        void Delete(string ns);
        DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
        DataTable List(int page, int pageSize, string condition, string sort);
        int GetRecordCount(Dictionary<string, object> condition);
        int GetRecordCount(string condition);

        void BuildAlias();

        void Install(string path);
        void Install(string fieldName, ref string uploadFile, bool isLast);
    }
    public interface IInstance : IDbObject
    {
        void Move(int from, int to);
    }
    public interface IChannel : IDbObject
    {
        void Move(int from, int to);

        void UploadLogo(string fieldName, ref string uploadFile, bool isLast);

        void UploadLink(string fieldName, ref string uploadFile, bool isLast);
    }
    public interface ISkin : IObject
    {
        Dictionary<string, object> Get(string path);
        Guid Add(Dictionary<string, object> item);
        void Modify(string path, Dictionary<string, object> changes);
        void Delete(string path);
        DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
        DataTable List(int page, int pageSize, string condition, string sort);
        int GetRecordCount(Dictionary<string, object> condition);
        int GetRecordCount(string condition);

        void Translate(string path, string to, bool moveImage);

        void UploadPicture(string fieldName, ref string uploadFile, bool isLast);

        void UploadThumbnail(string fieldName, ref string uploadFile, bool isLast);
    }
    public interface ITemplate : IObject
    {
        Dictionary<string, object> Get(string path);
        Guid Add(Dictionary<string, object> item);
        void Modify(string path, Dictionary<string, object> changes);
        void Delete(string path);
        DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
        DataTable List(int page, int pageSize, string condition, string sort);
        int GetRecordCount(Dictionary<string, object> condition);
        int GetRecordCount(string condition);

        void ClearCache(string templatePath);

        void Encrypt(string templatePath);
        void Decrypt(string templatePath);

        void Install(string path);
        void Install(string fieldName, ref string uploadFile, bool isLast);
    }
    public interface IMenu : IDbObject
    {
        void Move(int from, int to);

        void UploadThumbnail(string fieldName, ref string uploadFile, bool isLast);
        void UploadFile(string fieldName, ref string uploadFile, bool isLast);

        void IncrementHitCount(int id);
        void IncrementDownCount(int id);

        int GetHitCount(int id);
        int GetDownCount(int id);
    }
    public interface IMenuCategory : IDbObject
    {
        void Move(int from, int to);
    }
    public interface IRewrite : IDbObject
    {
		void Move(int from, int to);
	}
    public interface IRole : IDbObject
    {
    }
    public interface IPrivilege : IDbObject
    {
    }
    public interface IPermission : IDbObject
    {
    }
    public interface IAdmin : IDbObject
    {
        void Recycle(int id);
        void Recover(int id);

        void Login(string name, string password, int minutes, string checkCode);
    }
    public interface ILog : IDbObject
    {
        void DeleteAll();
    }
    public interface IPlayer : IDbObject
    {
        void Move(int from, int to);

        void UploadFile(string fieldName, ref string uploadFile, bool isLast);

        void CreateAllCodeFile();

        string Parse(string url, string type, bool findSource);
    }
    public interface IUtility : IObject
    {
        void BackupSite();
        void BackupDb(string name);
        void RestoreDb(string name);
        void CompactDb();
        void DeleteDbBackup(string name);
        DataTable GetDbBackupList();

        void ClearCache();
        void UpdateTemplateCache();
        void InitSystem();

        void ReplaceEotRootString(string rootString);
        bool SendEmail(string toMail, string toName, string subject, string body);

        string CheckUpgrade();
        void UploadUpgrade(string fieldName, ref string uploadFile, bool isLast);
        void Upgrade();

		void ScaleImage(string source, string target, int width, int height, int maxWidth = 0, int maxHeight = 0);
		string GetServerTime();
    }
    public interface IFileManager : IObject
    {
        void CreateFolder(string path);
        void Delete(string path);
        void Rename(string from, string to);
        void Move(string from, string to);
        void Copy(string from, string to);
        void Zip(string from, string to);
        void UnZip(string from, string to);
        DataTable List(int page, int pageSize, string condition, string sort);
        int GetRecordCount(string condition);

        void Upload(string fieldName, ref string uploadFile, bool isLast);
    }
    public interface IPayment : IDbObject
    {
        void UploadLogo(string fieldName, ref string uploadFile, bool isLast);
    }
    public interface ILink : IDbObject
    {
        void Check(int id);
        void UnCheck(int id);
        void Move(int from, int to);

        void UploadLogo(string fieldName, ref string uploadFile, bool isLast);
    }
    public interface ILinkCategory : IDbObject
    {
        void Display(int id);
        void UnDisplay(int id);
        void Recommend(int id);
        void UnRecommend(int id);
        void Hold(int id);
        void UnHold(int id);

        void Move(int from, int to);
        void MoveRecommend(int from, int to);
        void MoveHold(int from, int to);

        void UploadPicture(string fieldName, ref string uploadFile, bool isLast);
    }
    public interface ITask : IDbObject
    {
    }
    public interface IOnlineService : IDbObject
    {
        void Move(int from, int to);
    }
    public interface IClient : IDbObject
    {
    }
	public interface IWhiteList : IDbObject
    {
	}
	public interface IBlackList : IDbObject
    {
	}
	public interface IKeywordFilter : IDbObject
    {
	}
    namespace Module
    {
        public interface IDictionary : AliCMS.IObject
        {
            Dictionary<string, object> Get(string ns, string name);
            void Add(string ns, Dictionary<string, object> item);
            void Modify(string ns, string name, Dictionary<string, object> changes);
            void Delete(string ns, string name);
            DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
            DataTable List(int page, int pageSize, string condition, string sort);
            int GetRecordCount(Dictionary<string, object> condition);
            int GetRecordCount(string condition);
        }
        public interface IObject : AliCMS.IObject
        {
            Dictionary<string, object> Get(string ns, int id);
            Guid Add(string ns, Dictionary<string, object> item);
            void Modify(string ns, int id, Dictionary<string, object> changes);
            void Delete(string ns, int id);
            void Move(string ns, int from, int to);
            DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
            DataTable List(int page, int pageSize, string condition, string sort);
            int GetRecordCount(Dictionary<string, object> condition);
            int GetRecordCount(string condition);
        }
        namespace Object
        {
            public interface IOperation : AliCMS.IObject
            {
                Dictionary<string, object> Get(string ns, int objectID, int id);
                Guid Add(string ns, int objectID, Dictionary<string, object> item);
                void Modify(string ns, int objectID, int id, Dictionary<string, object> changes);
                void Delete(string ns, int objectID, int id);
                DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
                DataTable List(int page, int pageSize, string condition, string sort);
                int GetRecordCount(Dictionary<string, object> condition);
                int GetRecordCount(string condition);
            }
            public interface IProperty : AliCMS.IObject
            {
                Dictionary<string, object> Get(string ns, int objectID, int id);
                Guid Add(string ns, int objectID, Dictionary<string, object> item);
                void Modify(string ns, int objectID, int id, Dictionary<string, object> changes);
                void Delete(string ns, int objectID, int id);
                void Move(string ns, int objectID, int from, int to);
                DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
                DataTable List(int page, int pageSize, string condition, string sort);
                int GetRecordCount(Dictionary<string, object> condition);
                int GetRecordCount(string condition);
            }
        }
    }
    namespace Channel
    {
        public interface IExtraInstance : IDbObject
        {
        }
        public interface IMenu : IDbObject
        {
            DataTable ListByRight(Guid channelID, int? parentInnerID);
        }
    }
    namespace Template
    {
        public interface IModule : IObject
        {
            void Add(string templatePath, Dictionary<string, object> item);
            void Delete(string templatePath, string mark);
            DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
            DataTable List(int page, int pageSize, string condition, string sort);
            int GetRecordCount(Dictionary<string, object> condition);
            int GetRecordCount(string condition);
        }
        public interface IDictionary : IObject
        {
            Dictionary<string, object> Get(string templatePath, string language, int id);
            void Add(string templatePath, string language, Dictionary<string, object> item);
            void Modify(string templatePath, string language, int id, Dictionary<string, object> changes);
            void Delete(string templatePath, string language, int id);
            DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
            DataTable List(int page, int pageSize, string condition, string sort);
            int GetRecordCount(Dictionary<string, object> condition);
            int GetRecordCount(string condition);

            void GetString(string templatePath, string lang);
        }
        public interface IPage : IObject
        {
            Dictionary<string, object> Get(string templatePath, string pathInTemplate);
            void Add(string templatePath, Dictionary<string, object> item);
            void Modify(string templatePath, string pathInTemplate, Dictionary<string, object> changes);
            void Delete(string templatePath, string pathInTemplate);
            DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
            DataTable List(int page, int pageSize, string condition, string sort);
            int GetRecordCount(Dictionary<string, object> condition);
            int GetRecordCount(string condition);

            void AddFolder(string templatePath, string folder);
            void DeleteFolder(string templatePath, string folder);
            DataTable ListFolder(string templatePath);

            void Encrypt(string templatePath, string pathInTemplate);
            void Decrypt(string templatePath, string pathInTemplate);
        }
        public interface IScript : IObject
        {
            Dictionary<string, object> Get(string templatePath, string name);
            void Add(string templatePath, Dictionary<string, object> item);
            void Modify(string templatePath, string name, Dictionary<string, object> changes);
            void Delete(string templatePath, string name);
            DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
            DataTable List(int page, int pageSize, string condition, string sort);
            int GetRecordCount(Dictionary<string, object> condition);
            int GetRecordCount(string condition);
        }
        public interface IMenu : AliCMS.IObject
        {
            Dictionary<string, object> Get(string templatePath, string ns, int id);
            Guid Add(string templatePath, string ns, Dictionary<string, object> item);
            void Modify(string templatePath, string ns, int id, Dictionary<string, object> changes);
            void Delete(string templatePath, string ns, int id);
            DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
            DataTable List(int page, int pageSize, string condition, string sort);
            int GetRecordCount(Dictionary<string, object> condition);
            int GetRecordCount(string condition);

            DataTable AuthorizedList(string templatePath, int instanceID);
            DataTable AuthorizedList(string templatePath, int instanceID, bool isMultiUser);
        }
    }
    namespace Skin
    {
        public interface IImage : IObject
        {
            DataTable ListFile(string skinPath, string folderName);
            DataTable ListFolder(string skinPath);
            void DeleteFile(string skinPath, string folderName, string fileName);
            void DeleteFolder(string skinPath, string folderName);
            void AddFolder(string skinPath, string folderName);

            void Upload(string fieldName, ref string uploadFile, bool isLast);
        }
        public interface ICss : IObject
        {
            Dictionary<string, object> Get(string skinPath, string name);
            void Add(string skinPath, Dictionary<string, object> item);
            void Modify(string skinPath, string name, Dictionary<string, object> changes);
            void Delete(string skinPath, string name);
            DataTable List(int page, int pageSize, Dictionary<string, object> condition, Dictionary<string, string> sort);
            DataTable List(int page, int pageSize, string condition, string sort);
            int GetRecordCount(Dictionary<string, object> condition);
            int GetRecordCount(string condition);
        }
    }
    namespace Delivery
    {
        public interface IRegion : IDbObject
        {
            void Delete(Guid deliveryID, Guid regionID);
        }
    }
}
